<?php

class Os_Model_DbTable_Os extends Zend_Db_Table_Abstract
{

    protected $_name = 'ordem_servico';
    protected $_primary = 'id';
    protected $_referenceMap = array(
    		'Usuarios' => array(
    				'columns' => 'id_usuario',
    				'refTableClass' => 'Usuarios_Model_DbTable_Usuarios',
    				'refColumns' => 'id',
    				'onDelete' => self::RESTRICT,
    				'onUpdate' => self::RESTRICT
    		),
    		'Cliente' => array(
    				'columns' => 'id_cliente',
    				'refTableClass' => 'Clientes_Model_DbTable_Clientes',
    				'refColumns' => 'id',
    				'onDelete' => self::RESTRICT,
    				'onUpdate' => self::RESTRICT
    		));
    public function fillSelectOs($order = 'id', $id_cliente=null) {
    	$sql = $this->select()->from($this, array('id',$order))->where('id_cliente = ?', $id_cliente)->order($order);
    	$result = $this->getAdapter()->fetchPairs($sql);
    	if($result)  	
    		return  $result;
    	else
    		return false;
    
    }

}

